package com.example.pojo;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by wushuai on 17/8/30.
 */
public class Account {

    private int id;
    private String userName;
    private String password;

    private String userCode;

    public int getId() {
        return id;
    }

    public String getUserName() {
        return userName;
    }

    public String getPassword() {
        return password;
    }

    public String getUserCode() {
        return userCode;
    }

    public void setId(int id) {
        this.id = id;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void setUserCode(String userCode) {
        this.userCode = userCode;
    }

    public Account (String username, String password) {
        this.userName = username;
        this.password = password;
    }

    public Account (int id, String userName, String password) {
        this(userName, password);
        this.id = id;
    }

    public Account (int id, String userName, String password, String userCode) {
        this(id, userName, password);
        this.userCode = userCode;
    }

    public Account () {}

    public Account mapRow (ResultSet rs, int num) throws SQLException {
        Account account = new Account();
        account.setId(rs.getInt(id));
        account.setPassword(rs.getString(password));
        account.setUserName(rs.getString("username"));
        return account;
    }
}
